package org.example.product.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.example.product.domain.MarketCrop;
import org.example.product.service.MarketCropService;
import org.example.product.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("mc")
public class MarkerCropController {
    @Autowired
    private MarketCropService marketCropService;
    @RequestMapping("list")
    public Result list(@RequestParam(defaultValue = "1") Integer pageNum){
        PageHelper.startPage(pageNum,10);
        List<MarketCrop> list = marketCropService.getList();
        return Result.success(new PageInfo<>(list));
    }

}
